package com.hsc.yalebao.tabChongZhi;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.BaseDataObject;
import com.hsc.yalebao.model.GetZZZHlistBaseBean;
import com.hsc.yalebao.model.PayTypeBean;
import com.hsc.yalebao.model.PayTypeListBean;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.CashierInputFilter;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.hsc.yalebao.weight.MyDialog1;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import okhttp3.Call;

public class XianXiaYinhangActivity extends BaseActivity
{
  private String TAG = "XianXiaYinlianActivity";
  private int bank_id;
  private GetZZZHlistBaseBean bean;
  private ImageView btn_modify;
  private Context context;
  private TextView edit_user_card_type;
  private EditText et_bank_name;
  private EditText et_cun_money;
  private EditText et_zhifu_zhanghao;
  private EditText et_zhifubao_huming;
  private int id;
  private Button img_comit;
  private ImageView img_user_card_type;
  private ImageView iv_title_right;
  private int mMaxNum = 5000000;
  private int mMinNum = 100;
  private PayTypeBean mPayTypeBean;
  private int memberid;
  private MyDialog1 myDialog1;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      case 2131099748:
      default:
        return;
      case 2131099699:
        XianXiaYinhangActivity.this.closeWindowSoftInput(XianXiaYinhangActivity.this.et_bank_name);
        XianXiaYinhangActivity.this.closeWindowSoftInput(XianXiaYinhangActivity.this.et_zhifubao_huming);
        XianXiaYinhangActivity.this.closeWindowSoftInput(XianXiaYinhangActivity.this.et_zhifu_zhanghao);
        XianXiaYinhangActivity.this.closeWindowSoftInput(XianXiaYinhangActivity.this.et_cun_money);
        CustomApplication.app.finishActivity(XianXiaYinhangActivity.this);
        return;
      case 2131100016:
        XianXiaYinhangActivity.this.getPayTypeList();
        return;
      case 2131100015:
        XianXiaYinhangActivity.this.showselecttypePopwindow();
        return;
      case 2131100006:
        XianXiaYinhangActivity.this.tv_copy_username.setBackgroundResource(2130838009);
        XianXiaYinhangActivity.this.delayed(XianXiaYinhangActivity.this.tv_copy_username);
        String str3 = XianXiaYinhangActivity.this.tv_username.getText().toString();
        if (TextUtils.isEmpty(str3))
        {
          UiUtil.showToast("复制失败");
          return;
        }
        UiUtil.showToast("复制成功");
        UiUtil.copy(str3, XianXiaYinhangActivity.this.context);
        return;
      case 2131100008:
        XianXiaYinhangActivity.this.tv_copy_bank_number.setBackgroundResource(2130838009);
        XianXiaYinhangActivity.this.delayed(XianXiaYinhangActivity.this.tv_copy_bank_number);
        String str2 = XianXiaYinhangActivity.this.tv_bankcard_number.getText().toString();
        if (TextUtils.isEmpty(str2))
        {
          UiUtil.showToast("复制失败");
          return;
        }
        UiUtil.showToast("复制成功");
        UiUtil.copy(str2, XianXiaYinhangActivity.this.context);
        return;
      case 2131100010:
      }
      XianXiaYinhangActivity.this.tv_copy_bank_address.setBackgroundResource(2130838009);
      XianXiaYinhangActivity.this.delayed(XianXiaYinhangActivity.this.tv_copy_bank_address);
      String str1 = XianXiaYinhangActivity.this.tv_bankaddress.getText().toString();
      if (TextUtils.isEmpty(str1))
      {
        UiUtil.showToast("复制失败");
        return;
      }
      UiUtil.showToast("复制成功");
      UiUtil.copy(str1, XianXiaYinhangActivity.this.context);
    }
  };
  private List<Integer> payIds = new ArrayList();
  private RelativeLayout rl_cunkuanfangshi;
  private TextView tv_bankaddress;
  private TextView tv_bankcard_number;
  private TextView tv_bankname;
  private ImageView tv_copy_bank_address;
  private ImageView tv_copy_bank_number;
  private ImageView tv_copy_username;
  private TextView tv_username;
  View view;
  private View view_title;

  private void TransMoney()
  {
    String str1 = this.et_zhifubao_huming.getText().toString().trim();
    String str2 = this.et_zhifu_zhanghao.getText().toString().trim();
    String str3 = this.et_cun_money.getText().toString().trim();
    String str4 = this.et_bank_name.getText().toString().trim();
    String str5 = this.edit_user_card_type.getText().toString();
    if ("".equals(str4))
    {
      UiUtil.showToast("银行名称不能为空");
      return;
    }
    if (!UiUtil.isAllChinese(str4))
    {
      UiUtil.showToast("请检查您的银行名称");
      return;
    }
    if ("".equals(str1))
    {
      UiUtil.showToast("请填写您的存款人姓名");
      return;
    }
    if (!UiUtil.isAllChinese(str1))
    {
      UiUtil.showToast("请检查您的存款人姓名");
      return;
    }
    if ("".equals(str2))
    {
      UiUtil.showToast("请填写账号");
      return;
    }
    if ("".equals(str3))
    {
      UiUtil.showToast("请填写金额");
      return;
    }
    try
    {
      if (Double.parseDouble(str3) > this.mMaxNum)
      {
        UiUtil.showToast("金额不能超过" + this.mMaxNum);
        return;
      }
    }
    catch (Exception localException1)
    {
      localException1.printStackTrace();
      try
      {
        if (Double.parseDouble(str3) < this.mMinNum)
        {
          UiUtil.showToast("金额不能低于" + this.mMinNum);
          return;
        }
      }
      catch (Exception localException2)
      {
        localException2.printStackTrace();
        LogUtils.e(this.TAG, "type = " + str5);
        boolean bool = "网银转账".equals(str5);
        int i = 0;
        if (bool)
          i = 1;
        if ("ATM自动柜员机".equals(str5))
          i = 2;
        if ("ATM现金入款".equals(str5))
          i = 3;
        if ("银行柜台".equals(str5))
          i = 4;
        setLoginBtnIsEnable(false);
        HashMap localHashMap = new HashMap();
        localHashMap.put("real_name", str1);
        localHashMap.put("memberid", this.memberid);
        localHashMap.put("bank_card", str2);
        localHashMap.put("bank_name", str4);
        localHashMap.put("bank_id", this.bank_id);
        localHashMap.put("money", str3);
        localHashMap.put("paytype", i);
        localHashMap.put("paymentid", this.id);
        LogUtils.e(this.TAG, "url" + AppConstants.URL_GET_SUBMITTRANSMONEY);
        RequestNet.get(this.context, AppConstants.URL_GET_SUBMITTRANSMONEY, localHashMap, new StringCallback()
        {
          public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
          {
            XianXiaYinhangActivity.this.setLoginBtnIsEnable(true);
            LogUtils.e(XianXiaYinhangActivity.this.TAG, "入账失败:TransMoney()" + paramAnonymousException);
          }

          public void onResponse(String paramAnonymousString)
          {
            XianXiaYinhangActivity.this.setLoginBtnIsEnable(true);
            Gson localGson = new Gson();
            try
            {
              localBaseDataObject = (BaseDataObject)localGson.fromJson(paramAnonymousString, BaseDataObject.class);
              if (localBaseDataObject == null)
                return;
            }
            catch (Exception localException)
            {
              BaseDataObject localBaseDataObject;
              do
              {
                while (true)
                {
                  localException.printStackTrace();
                  localBaseDataObject = null;
                }
                if (localBaseDataObject.getFlag() == -4)
                {
                  XianXiaYinhangActivity.activityStack.backToMain(MainActivity.class, XianXiaYinhangActivity.this.context);
                  return;
                }
                if (localBaseDataObject.getFlag() == 0)
                {
                  if (localBaseDataObject.getMsg() != null)
                    XianXiaYinhangActivity.this.ShowDialog1(localBaseDataObject.getMsg());
                  LogUtils.e(XianXiaYinhangActivity.this.TAG, "入账失败：" + localBaseDataObject.getMsg());
                  return;
                }
                if (localBaseDataObject.getFlag() == -2)
                {
                  XianXiaYinhangActivity.this.showDownWireDialog();
                  return;
                }
                if (localBaseDataObject.getFlag() == -3)
                {
                  XianXiaYinhangActivity.this.ShowFengjinDialog();
                  return;
                }
              }
              while (localBaseDataObject.getFlag() != 1);
              LogUtils.e(XianXiaYinhangActivity.this.TAG, "入账成功  baseDataObject.getFlag()==1");
              XianXiaYinhangActivity.this.ShowDialog1(localBaseDataObject.getMsg());
              XianXiaYinhangActivity.this.et_zhifubao_huming.setText("");
              XianXiaYinhangActivity.this.et_zhifu_zhanghao.setText("");
              XianXiaYinhangActivity.this.et_cun_money.setText("");
              XianXiaYinhangActivity.this.et_bank_name.setText("");
            }
          }
        });
      }
    }
  }

  private void dealPayList(List<PayTypeBean> paramList)
  {
    this.payIds = new ArrayList();
    Iterator localIterator;
    if ((paramList != null) && (paramList.size() > 0))
      localIterator = paramList.iterator();
    while (true)
    {
      if (!localIterator.hasNext())
      {
        if (this.payIds.contains(Integer.valueOf(this.id)))
          break;
        this.myDialog1 = new MyDialog1(this);
        this.myDialog1.setMessage("此充值方式已关闭,请返回选择其他充值方式");
        this.myDialog1.btn_confirm.setOnClickListener(new View.OnClickListener()
        {
          public void onClick(View paramAnonymousView)
          {
            XianXiaYinhangActivity.this.myDialog1.dismiss();
          }
        });
        this.myDialog1.show();
        return;
      }
      PayTypeBean localPayTypeBean = (PayTypeBean)localIterator.next();
      try
      {
        int i = Integer.valueOf(localPayTypeBean.getIsSdkEffective()).intValue();
        this.payIds.add(Integer.valueOf(i));
      }
      catch (Exception localException)
      {
      }
    }
    TransMoney();
  }

  private void delayed(final ImageView paramImageView)
  {
    new Handler().postDelayed(new Runnable()
    {
      public void run()
      {
        if (paramImageView != null)
          paramImageView.setBackgroundResource(2130838008);
      }
    }
    , 2000L);
  }

  private void init()
  {
    this.bean = ((GetZZZHlistBaseBean)getIntent().getSerializableExtra("bean"));
    this.id = getIntent().getIntExtra("id", 0);
    this.mPayTypeBean = ((PayTypeBean)getIntent().getSerializableExtra("payTypeBean"));
    if (this.mPayTypeBean != null)
    {
      this.mMaxNum = ((int)Double.valueOf(this.mPayTypeBean.getMax_paymoney()).doubleValue());
      this.mMinNum = ((int)Double.valueOf(this.mPayTypeBean.getMin_paymoney()).doubleValue());
    }
    if (this.bean != null)
    {
      this.bank_id = this.bean.getId();
      String str1 = this.bean.getBankname();
      String str2 = this.bean.getBankaddress();
      String str3 = this.bean.getAccountholder();
      String str4 = this.bean.getBankcardid();
      this.tv_bankname = ((TextView)findViewById(2131100004));
      this.tv_bankname.setText(str1);
      this.tv_username = ((TextView)findViewById(2131100005));
      this.tv_username.setText(str3);
      this.tv_bankaddress = ((TextView)findViewById(2131100009));
      this.tv_bankaddress.setText(str2);
      this.tv_bankcard_number = ((TextView)findViewById(2131100007));
      this.tv_bankcard_number.setText(str4);
    }
    this.rl_cunkuanfangshi = ((RelativeLayout)findViewById(2131100015));
    this.rl_cunkuanfangshi.setOnClickListener(this.onClickListener);
    this.et_zhifubao_huming = ((EditText)findViewById(2131100012));
    this.et_zhifu_zhanghao = ((EditText)findViewById(2131100013));
    this.et_cun_money = ((EditText)findViewById(2131100014));
    this.et_bank_name = ((EditText)findViewById(2131100011));
    this.img_comit = ((Button)findViewById(2131100016));
    this.img_user_card_type = ((ImageView)findViewById(2131099748));
    this.edit_user_card_type = ((TextView)findViewById(2131099735));
    this.tv_copy_username = ((ImageView)findViewById(2131100006));
    this.tv_copy_bank_number = ((ImageView)findViewById(2131100008));
    this.tv_copy_bank_address = ((ImageView)findViewById(2131100010));
    this.tv_copy_username.setOnClickListener(this.onClickListener);
    this.tv_copy_bank_number.setOnClickListener(this.onClickListener);
    this.tv_copy_bank_address.setOnClickListener(this.onClickListener);
    this.edit_user_card_type.setText("网银转账");
    this.edit_user_card_type.setOnClickListener(this.onClickListener);
    this.img_comit.setOnClickListener(this.onClickListener);
    this.img_user_card_type.setOnClickListener(this.onClickListener);
    this.et_cun_money.setInputType(3);
    InputFilter[] arrayOfInputFilter = new InputFilter[1];
    arrayOfInputFilter[0] = new CashierInputFilter();
    this.et_cun_money.setFilters(arrayOfInputFilter);
    this.et_cun_money.setHint("请填写您此次转账的金额(" + this.mMinNum + "-" + this.mMaxNum + ")");
  }

  private void setLoginBtnIsEnable(boolean paramBoolean)
  {
    this.img_comit.setEnabled(paramBoolean);
  }

  @SuppressLint({"NewApi"})
  @TargetApi(12)
  private void showselecttypePopwindow()
  {
    this.view = LayoutInflater.from(this.context).inflate(2130903173, null);
    int i = this.rl_cunkuanfangshi.getWidth();
    int j = this.rl_cunkuanfangshi.getHeight();
    final PopupWindow localPopupWindow = new PopupWindow(this.view, i, -10 + j * 2, true);
    ListView localListView = (ListView)this.view.findViewById(2131100233);
    final String[] arrayOfString = { "网银转账", "银行柜台" };
    localListView.setAdapter(new ArrayAdapter(this.context, 2130903047, arrayOfString));
    localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        try
        {
          XianXiaYinhangActivity.this.edit_user_card_type.setText(arrayOfString[paramAnonymousInt]);
          localPopupWindow.dismiss();
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localPopupWindow.setOutsideTouchable(true);
    localPopupWindow.setFocusable(true);
    localPopupWindow.setBackgroundDrawable(this.context.getResources().getDrawable(2130838170));
    localPopupWindow.showAsDropDown(this.edit_user_card_type, 0, 0);
    localPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener()
    {
      public void onDismiss()
      {
      }
    });
  }

  public void getPayTypeList()
  {
    HashMap localHashMap = new HashMap();
    if (CustomApplication.app.userBaseBean == null)
      return;
    localHashMap.put("memberid", CustomApplication.app.userBaseBean.getMemberid());
    RequestNet.get(this, AppConstants.URL_GETPAYSTATE, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        LogUtils.e(XianXiaYinhangActivity.this.TAG, "获取失败getoauthuserstate()-result:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        LogUtils.e(XianXiaYinhangActivity.this.TAG, "result:" + paramAnonymousString);
        Gson localGson = new Gson();
        try
        {
          localPayTypeListBean = (PayTypeListBean)localGson.fromJson(paramAnonymousString, PayTypeListBean.class);
          if (localPayTypeListBean == null)
            return;
        }
        catch (Exception localException)
        {
          PayTypeListBean localPayTypeListBean;
          do
          {
            while (true)
            {
              localException.printStackTrace();
              localPayTypeListBean = null;
            }
            if (localPayTypeListBean.getFlag() == -4)
            {
              ActivityStack.getInstance().backToMain(MainActivity.class, XianXiaYinhangActivity.this);
              return;
            }
            if (localPayTypeListBean.getFlag() == 0)
            {
              XianXiaYinhangActivity.this.ShowDialog1(localPayTypeListBean.getMsg());
              return;
            }
            if (localPayTypeListBean.getFlag() == -2)
            {
              MainActivity.mainActivity.showOffLineDialog();
              return;
            }
            if (localPayTypeListBean.getFlag() == -3)
            {
              MainActivity.mainActivity.showFengjinDialog();
              return;
            }
          }
          while (localPayTypeListBean.getFlag() != 1);
          XianXiaYinhangActivity.this.dealPayList(localPayTypeListBean.getResult());
        }
      }
    });
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903096);
    CustomApplication.app.addActivity(this);
    this.context = this;
    setTitle(8, 0, 2130837809, "填写存款信息", 0, 8, 8, 0, true);
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    init();
  }

  protected void onDestroy()
  {
    super.onDestroy();
  }

  protected void onPause()
  {
    super.onPause();
    closeWindowSoftInput(this.et_bank_name);
    closeWindowSoftInput(this.et_zhifubao_huming);
    closeWindowSoftInput(this.et_zhifu_zhanghao);
    closeWindowSoftInput(this.et_cun_money);
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabChongZhi.XianXiaYinhangActivity
 * JD-Core Version:    0.6.2
 */